//
//  CellModel.m
//  test
//
//  Created by huichen on 2018/6/5.
//  Copyright © 2018年 huichen. All rights reserved.
//

#import "CellModel.h"

@implementation CellModel

- (instancetype)initWithTitle:(NSString *)title{

    self = [super init];
    if (self) {
       
        self.title = title;
        self.fontSize = 16.0;
        UIFont *font = [UIFont systemFontOfSize:16.0];
        self.titleHeight = font.lineHeight;
        
        self.bgColor = [UIColor whiteColor];
        self.textColor = [UIColor blackColor];
        self.borderColor = [UIColor lightGrayColor];
        self.borderWidth = 1.0;
        
        CGRect frame = [title boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, font.lineHeight) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:[NSDictionary dictionaryWithObjectsAndKeys:font,NSFontAttributeName, nil] context:nil];
        self.titleWidth = frame.size.width + 40;
    }
    return self;
}

- (instancetype)initWithTitle:(NSString *)title
                     fontSize:(CGFloat)size
                      bgColor:(UIColor *)bgColor
                    textColor:(UIColor *)textColor
                  borderColor:(UIColor *)borderColor
                  borderWidth:(CGFloat)borderWidth{

    self = [super init];
    if (self) {
       
        self.title = title;
        self.fontSize = size;
        UIFont *font = [UIFont systemFontOfSize:size];
        self.titleHeight = font.lineHeight;
        
        self.bgColor = bgColor;
        self.textColor = textColor;
        self.borderColor = borderColor;
        self.borderWidth = borderWidth;
        
        CGRect frame = [title boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, font.lineHeight) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:[NSDictionary dictionaryWithObjectsAndKeys:font,NSFontAttributeName, nil] context:nil];
        self.titleWidth = frame.size.width + 40;
    }
    return self;
}
@end
